Repository navigation
chore: sync fork/t3-mobile with upstream main (v1.2.0, 3a2c1ade) - #18
Merged
Merged
Conversation
The code pane drew through drawRect: on one view sized to the whole block, so a tall block with long lines needed a backing store larger than iOS would allocate and showed an empty pane until wrapping narrowed it. The pane now draws through a canvas child that switches to a CATiledLayer once it is too big for one store; smaller blocks still draw in their first frame. Fixes pingdotgg/t3code#32928
…der than the screen (software-mansion#1076) The popup's x was clamped with coerceIn(margin, screenW - width - margin), which throws IllegalArgumentException once the popup is wider than the screen minus both margins, so long-pressing a code block, table or blockquote with long menu labels or a large font crashed the app. Take the standalone library's coerceAtMost/coerceAtLeast clamp (from software-mansion#807), which pins a too-wide popup to the left margin, and move the position math into a function the new unit test covers.
…nsion#1065) * fix(android): keep a code block's box inside a list item Port of the code block part of the React Native fix for list items with block children (software-mansion#478): - The list item no longer trims the newlines its children leave, so a code block that ends an item keeps its bottom padding and rounded corners. - The item's list spans are split around its code blocks, and the code block draws its box from the item's text column (CodeBlockSpan.leadingIndent) instead of the left edge. Only the first segment draws the marker. - Task toggling flips every segment of a split item, and HTML and accessibility output stay consistent with the split spans. - Copy-as-markdown nests a code block under its item (CodeBlockSpan.listItem): the fences and code lines are indented to the item's text column, an item that opens with a code block puts its marker on the opening fence, and text after the block continues the item instead of starting a new one. * chore(android): drop an unused test helper and note the spacer lines in list items The spacer line a block leaves at the end of an item now stays, and the list's line height makes every spacer line in an item a full line tall. * fix(android): end code blocks and open quotes on spacer lines in the HTML export The bottom-margin line a block leaves inside a list item or a quote was skipped before it could close an open code block, so consecutive code blocks merged into one <pre>, and a quote that opened with a code block lost its <blockquote>. The spacer line now closes the code block and, in a quote, opens the quote. * fix(android): close a quote on the spacer line before a code block in the HTML export
software-mansion#1135) With clipped subviews, the default in a FlatList on Android, a text view can build its first layout before it is in a window. Editor then disables selection and doesn't re-check on attach, so the text can't be selected. Set a new movement method in onAttachedToWindow, which makes Editor re-check.
…on#1125) * feat: report selection copies through onSelectionCopy Fires for the selection menu's Copy, Copy as Markdown and Copy Image URL items and for keyboard copy, with the copied text, its format and the selection range. Closes software-mansion#987 * fix: handle refused clipboard writes in selection copy Android key copy no longer crashes when the clipboard refuses a clip: it retries without the HTML, then falls back to the platform's copy. It also closes the selection toolbar again. On macOS, a discontinuous selection stays with the system copy, unreported. Also describes github flavor offsets in terms of blocks, and adds tests for rich clipboard types, Copy Image URL, nested quotes and the JS event mapping. * fix(android): deliver every selection copy and surface refused menu copies Copy events no longer coalesce, so a queued copy can't overwrite an earlier one. The menu's plain Copy now shares onTextContextMenuItem with Ctrl+C, which falls back to the platform's failure toast, and the other copy items keep the toolbar open when the clipboard refuses the clip. * docs: mention keyboard and TalkBack copies for onSelectionCopy
…ansion#1129) * fix(android): draw words after an image that opens a line The no-copy spannable from software-mansion#889 hid span changes from DynamicLayout, so an image that got its size after layout never reflowed its line. Re-report those changes as the wrapper, size images before the first layout, keep the image height off the lines after it, and take padding off the width. * fix(android): repaint a loaded image that keeps its size Laying out a paragraph measures all of its images, so reflowing on every load is quadratic in the images a paragraph holds. An image that fills the box its placeholder held only needs repainting. A re-set on the inner buffer does that: it reaches the TextView, which records its display lists again, but not its DynamicLayout. * test(android): move the software-mansion#932 image test to ImageLineLayoutTest * fix(android): re-measure when a block image is fitted without a reflow Sizing images in onMeasure left registerTextView's posted check with no new width to report, so a component measured before its image was cached kept the maxHeight height. A displayed image now asks for a re-measure once after registering, and again when a load keeps its size. * refactor(android): stop re-setting the text when an image changes height Setting the span again now reflows DynamicLayout, because the wrapper reports the change as itself, so software-mansion#1128's view.text = text is no longer needed. * fix(android): refit an image cached mid-load, repaint pills without reflow An image cached between its download and its callback could shrink during a measure at the same width. The old layout stayed, leaving the image line at maxHeight, so prepareForMeasurement now reports height changes too. Forwarding span changes to DynamicLayout also made pill icon loads and spoiler reveals lay the paragraph out again. Neither changes the pill's size, so they now repaint. A failed icon still reflows, because it gives up its slot. * fix(android): skip the re-measure for images that have not loaded An unloaded image still has its placeholder box, so the component's height can't be stale, and its load callback notifies anyway. Each re-measure is a full-document store() on the main thread, so N remote images cost N layouts in the first frame. Add a remoteLoader seam to ImageDownloader so the tests no longer reach into inFlight by reflection.
* fix(ios): scale inline images with the font Inline images used the raw inlineImage.size, so with a larger Dynamic Type setting the text around them grew and they stayed small. Their size now goes through the same multiplier as the paragraph font, which honours allowFontScaling and maxFontSizeMultiplier. * Update packages/react-native-enriched-markdown/ios/attachments/ENRMImageAttachment.m Co-authored-by: Maksymilian Galas <max@infinitypi.co> --------- Co-authored-by: Maksymilian Galas <max@infinitypi.co>
* fix(ios): show alt text when an image fails to load A failed download left an empty box. Block images now keep their box and draw a tint, a picture glyph and centred alt text. Inline images grow into a capped chip, using a process-wide list of failed requests because measurement builds its own attachments. * test(ios): cover images that fail to load * fix(android): show alt text when an image fails to load A failed download left an empty box. Block images now keep their box and draw a tint, a picture glyph and centred alt text. Inline images grow into a capped chip, using a process-wide list of failed requests because measurement builds its own spans. * test(android): cover images that fail to load * fix(ios): keep block images inside a list item's indent TextKit proposes the line's full width and applies the paragraph's indents afterwards, so a block image in a list item ran past the right edge by the indent. Subtract the indents, as link pills already do. * refactor(android): create the image failure drawable only when needed Most images never fail, so don't allocate its paints for every span. The colour and font size are still read at construction, because paragraphStyle is only the table cell's style while the cell renders. * fix(android): draw a failed image once its view has a width * fix(android): fit a failed inline image's chip to its line * fix(ios): scale a failed image's alt text with the user's text size * fix(ios): refresh VoiceOver frames when an image changes the layout
…mansion#1164) No open issues or PRs track web editor bugs, so mark it like the other targets. The missing native features stay listed under Not supported on web and in the roadmap.
…ght (software-mansion#1157) * fix: fit inline images in their square and centre them on the cap height * test(ios): drop the trailing comma SwiftLint rejects * test(ios): check an inline image takes the font of bold text
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…software-mansion#1170) The column pass skipped every image, so a chip that failed after the table was laid out kept the narrow column's width and its column never grew. Block images still wait for the row pass.
…oftware-mansion#1174) * fix(ios): toggle the tapped task item after a table, code block or quote * fix: match only ASCII digits in ordered task markers
* ci(ios): run SwiftLint on ubuntu-latest The lint itself takes seconds, but the job waited behind every other macOS job for a runner. SwiftLint ships a Linux binary, and the only other step the job needs, restoring the vendored sources, runs on any platform. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(android): use the preinstalled Temurin JDK The runner image ships Temurin 17 in the tool cache, so setup-java resolves it locally instead of downloading a Zulu build on every job. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(android): cache the Robolectric Android jars Robolectric fetches an android-all jar per SDK level into ~/.m2 the first time a test runs, over 100 MB each, and nothing kept them between jobs. Keep that directory keyed on the module build files that pin the Robolectric version. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(android): manage the Gradle home with setup-gradle and enable the build cache The Gradle cache was keyed on the wrapper properties alone, so one entry per Gradle version was written once and never refreshed, and nothing enabled the build cache that could have lived in it. setup-gradle keys the home per job, saves from main only, prunes unused entries, and splits dependencies into deduplicated bundles. A user-level gradle.properties turns on the build cache and parallel execution and raises the daemon heap; the JAVA_OPTS the jobs set never reached Gradle, because turbo's strict env mode filters undeclared variables. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(android): compile native code through ccache Both Android build jobs compile the tree-sitter grammars, the core and, with no RNRepo prebuilds for this React Native version, the third-party modules from scratch on every run. CMake reads the compiler launcher from the environment, so two variables route every module's native build through ccache without touching their build files; the cache is restored from main and saved there only, to keep it out of the per-branch cache budget. turbo's strict env mode needs the variables declared to pass them on. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(android): build one ABI of the native example The example build compiled the parser and code-highlight native code for all four ABIs, eight CMake builds that CI never runs on a device. The ABI list comes from the enrichedMarkdownArchitectures Gradle property, which CI sets to arm64-v8a; local builds and the publish workflow keep the full set. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(ios): key the CocoaPods cache on the Podfile and keep the React Native downloads The jobs delete Podfile.lock before the cache step hashes it, so every run read and wrote the one entry under an empty hash. Key the entry on the Podfile and the lockfile instead, and include the directory where pod install keeps the React Native prebuilt tarballs, which it fetched again on every run. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(ios): compile pods through ccache Both React Native iOS jobs compile the third-party modules and the tree-sitter grammars from source. Wrappers written at job start, with ccache's path, React Native's ccache config and the cache directory baked in, reach every target of both xcodebuild invocations through XCODE_XCCONFIG_FILE. React Native's own USE_CCACHE switch does not work here: its wrapper execs a build setting that Xcode does not export to compiler invocations, and the CLI's build command reinstalls the pods on a fresh machine and drops the settings anyway. A cold build fills 0.7 GB, so the limit is 2 GB; the two jobs build the same pods and share one cache, restored from main and saved there by the test job. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(ios): check the turbo cache on Linux before dispatching macOS runners A macOS job whose turbo task was already cached still waited hours for a runner, then spent three minutes confirming the hit; most runs on main went that way. The turbo task hash has no platform component, so one Linux job per lane prepares the tree the way that lane's macOS jobs do, restores their turbo caches, runs the same dry runs and prints the hash behind each decision; the macOS jobs run only on a miss. A failing dry run fails the step instead of passing as a miss. ci-success treats a job skipped on a hit as passed, and a failed pre-check leaves that lane's macOS jobs running as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci: pin the ccache action to a release that reaches the cache service v1.2.9 bundles @actions/cache 3, which the cache service now answers with 400, so every ccache step restored nothing, saved nothing and stayed green. v1.2.24 talks to the current service and honours CCACHE_DIR. The gradle/actions pin named the annotated tag object of v6.4.0 rather than its commit. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(ios): fold the example builds into the test jobs Each of the two iOS lanes held two macOS queue slots per run, and the build job repeated work the test job already did: xcodebuild test builds the same React Native app, and the native example build is 30 seconds of work behind minutes of setup. The React Native lane keeps one job, rn-ios-build-and-tests, whose test build covers the app; the native lane keeps one job, ios-build-and-tests, which runs the example build and the package tests as two turbo tasks in one invocation, so each still has its own cache entry. The pre-checks gate each job on all of its tasks being cached. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci(ios): keep pod install's files out of the RN iOS turbo hash Both RN iOS jobs delete Podfile.lock before the turbo dry run, and pod install recreates it and writes the gitignored ios/.xcode.env.local before the task runs. Both files match the ios/** input, so the result was stored under a hash the pre-check could never compute and the macOS job never skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…nsion#1140) * perf: stop measuring the whole document on every streaming update A streaming update re-rendered and laid out the whole document in the shadow node, on the thread React runs on, and rendered it again in the view. On a long document that held the JS thread busy, so the stream reached the screen several times slower than it arrived. When the markdown only grew and nothing else that sizes the content changed, the shadow node now takes the size the view laid its last render out at. The view already asks for a new layout when its height changes, so the height trails by at most the render in flight. New content, another width, prop changes, block slot children and the first mount still measure in full. The render coordinators (iOS and the new Android one) apply a finished render when it is newer than the one shown, even if a newer render is pending. Without that, updates arriving faster than a render takes would discard every result and freeze the screen until the stream ends. Android also renders only the newest pending update instead of every queued one. Since an older render can now apply after a newer one is scheduled, the dirty flags and style fingerprint are taken when a render is scheduled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: drop the last applied render id from the render coordinators Renders run one at a time and their applies reach the main thread in order, so a newer render can never apply before an older one: the check rejected nothing. Only the invalidation bound remains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(android): call the stream measurement members directly The tests reached them by reflection, which compiles against nothing: a renamed parameter or a changed signature only fails at run time. They are internal now, as chooseMeasurement already is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): publish the laid-out size from every layout of the segments Restacking for a streaming animation change, new slot heights or a reveal step laid the segments out without publishing their size, so a stream's next measurement could take a stale one. Publishing from layoutSegments itself covers every path, as iOS does from computeSegmentLayoutForWidth. Also drops the pending rendered markdown in EnrichedMarkdownText's cleanup, with the pending text it belongs to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(ios): name the stream measurement's inputs and test what decides a stream update The check telling a stream's update from new content was inline in ENRMMeasureMarkdownContent and untested; ENRMIsStreamUpdate holds it now, with a table test. ENRMChooseMeasurement takes its six flags as named fields instead of positional bools, the key without markdown or width gets its own builder, and a full measurement derives its cache key from that one instead of building it twice more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ios): build the library tests as C++20 The library's XCTests now include headers that reach React Fabric's (ShadowMeasurementUtils.h, EnrichedMarkdown.h), which need C++20; the test target was the one target still on C++17. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: recreate the segments for every render scheduled to A render applied only the flags it was scheduled with that were still set. Two style changes in flight both scheduled a render that recreates the segments; the first took the flag, so the second, carrying the newer style, kept the views the first made and their old style. A render now takes all the flags it was scheduled with. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(core): prepare streamed markdown in one core session Every streaming consumer (the iOS and Android views, their view-free measurement and the JS block collector) now gets the same snapshot from a core StreamingSession behind DocumentStore: the blocks that can no longer change stay as they are, the filter withholds trailing blocks still arriving, and repair, now compiled into every native build, handles inline syntax still being typed. The commonmark flavor gets the same handling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(core): keep finding finished blocks after a closed HTML block finishedBlocksEnd stopped at the first HTML block that may hold blank lines (a comment, <pre>, <script>, <style>, <textarea>, <?, <!), closed or not. After one such block every update filtered, repaired and parsed the whole document again. It now skips the block until the text that closes it, as md4c ends it. Tag names compare ignoring case and end at a space, > or the line's end: <PRE> opened a block the boundary didn't see, and <prefix> one it did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(core): show math whose closing `$` ends the streamed text A trailing `$` run was always withheld as a possible opener, so finished math at the very end (`$O(n)$`, a `$$` block without its newline) and currency like `5$` vanished until the next character. The run now shows when it closes math opened earlier in its scope or follows a character after which no math opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(core): read `$$` as math in the streaming filter only with latexMath The parser's flags reached repair but not the filter or finishedBlocksEnd, so with latexMath off a `$$` line still cut everything after it and held the finished boundary there until the stream ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(core): check that the session repairs the tail as it would the whole Every streamed prefix of the fixtures now also compares the snapshot with repairing the whole filtered document, and runs once with latexMath off. The HTML block case is left out of the repair comparison: repair reads raw HTML as Markdown, so only the tail repairs it right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(core): say the finished boundary fixes bytes, not their parse A later reference definition still turns an earlier `[docs][r]` into a link, so the finished part is fixed text, not fixed blocks. Also drops HTML from a comment where startsTopLevelBlock already rules it out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(ios): read streamingConfig modes with one helper The "hidden" check was written out at three places: both views' updateProps and the view-free measurement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ios): re-render on a streamingConfig change only while streaming The modes only shape the streaming snapshot, so a change while not streaming re-rendered the same text. Android already skips it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): look up the Md4cFlags field ids once Every parse and streaming snapshot looked up the class and ten field ids again. The ids are now cached on first use, and a missing field clears its NoSuchFieldError instead of leaving it pending for later JNI calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf: render only the tail of a streamed text segment While a document streams, every update rendered every text segment again and replaced each view's whole text, so a growing answer got slower the longer it got. A per-view cache of the previous render (TextRenderCache on Android, ENRMTextRenderCache on iOS) hands unchanged text segments over as they were, so the reconciler keeps their views. The last text segment resumes from its first changed top-level node, never earlier than the previous last one, and carries a patch: the revision it is based on, the start offset and the new tail. The commonmark flavor renders its single text through the same cache. A view applies a patch only when it shows the base revision. Android edits the adopted buffer in one batched change and tells only DynamicLayout, so it reflows from the edited paragraph and a focused view does not scroll its parent; the commonmark shadow node takes the size from that layout. iOS edits the NSTextStorage, rendering the tail after a seed from the text before it, and merges links, images, list items and accessibility ranges. A view that missed a patch keeps its text and the host renders again in full. Android builds the accessibility tree lazily while accessibility is off, so a patch does not rebuild it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: re-render the last text node when the nodes after it are gone A stream's last text segment re-renders from its old last node and patches the view from there. When the nodes after the new last one are gone (a link reference definition shows as a paragraph until its URL arrives, then renders nothing), that node kept the spacing before them: the patched text ended in a newline a full render doesn't have. On Android the delete-only patch also made DynamicLayout join the paragraph's lines into one, wider than the view, and the view settled shorter than the text. The new last node now renders again too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ios): render in full a text patch that starts past the shown text Android refused such a patch and rendered in full; iOS replaced from the patch's start unchecked, which throws when the view's text is shorter than the revision the patch was made from. Both iOS hosts now treat it as a missed patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(android): invalidate the segmented host's text render cache by epoch The cache was dropped three ways: a volatile stale flag, RECREATE_SEGMENTS and the style as its key. The flag was read and reset on the executor, so a set from the main thread between the two was lost. An epoch bumped on the main thread and captured with the render, as iOS and the text host already key theirs, replaces all three: every style input recreates the segments, which bumps it too. The text host now ends a failed render the same way, by clearing the cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): set the whole text when a patch would reach no layout A text patch tells the edit only to the DynamicLayout watching the buffer, found by its watcher's class. A view whose layout isn't watching (any but a DynamicLayout, or one the lookup misses) heard nothing and kept its old lines. The patch now reports that no layout was told, leaving the text as it is, and the view sets the whole text instead. Watcher proxies are keyed by identity: a watcher with its own equals must not stand in for another. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(android): check storeLaidOut against measuring the whole text A streaming view stores its size from the lines its layout reflowed, reusing the widths of the lines before the patch. Nothing checked that this matches a full measurement, nor the cases where the layout isn't the one the measurement would build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(android): resume a streamed text after every block kind Resuming a render at a top-level node holds only if every such node renders nothing or ends in a newline, which renderers read as the start of the text. The cache test covered headings, paragraphs and lists; it now streams blockquotes, code blocks, a thematic break and block images too, and checks that a patch's image spans keep their starts. The invariant is stated where the block starts are recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(ios): check whether a text patch fits in one place Both iOS hosts spelled out the same three conditions for applying a patch to the text a view shows, the start-past-the-end one included. ENRMRenderResult now answers it. The text host's patchFits: also stopped taking over applyRenderedText:'s doc comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: say what the text render cache resumes from plainly The comments on where a resumed render starts read "so does" against nothing. They now say it starts at the first changed node, no later than the last node of either render, and why. The unknown segment signature is one practically no segment has, not one none can. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(ios): draw only the part of a long document near the screen A non-scrolling TextKit 1 text view keeps a bitmap of its whole frame, about 7.5 MB per screen of text: an 80 KB document held 1.1 GB once mounted (2.4 GB with the commonmark flavor), and block segments kept theirs off screen too. The text view keeps its whole frame, so UIKit's selection, menus, hit testing and accessibility work on it as before. ENRMTextTiles keeps UIKit's canvas view 0 high instead and draws the text in 512 pt tiles with the same layout manager, only over the rect ENRMTextViewport gives it: the part of the text the enclosing scroll views show, plus 600 pt on each side, and nothing out of the window. The visible area follows scrolls and the transforms of the views between the text and its scroll views (Animated's native driver). Tiles redraw from the line an edit or a display invalidation touched, worked out once the text storage is done editing, and on a dark mode change. The text view builds its TextKit 1 stack with a container whose size only the viewport sets. UIKit sizes a text view's container to its frame on every frame change, so a growing text dropped its whole layout and laid it out again on each streamed update; now every stream shows every update. The segmented host drops the bitmaps of block segments (code blocks, tables, quotes) far off screen and draws them again when they come back. A block image loaded before it was ever drawn still settles its height. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(ios): drop the text viewport's redundant active flag The drawn top and bottom, with the content frame, already say whether a text draws only part of itself, and an off-screen text and one out of the window take the same branch. Measuring at another width than the frame's now makes the next update size the container back, where it kept the measured width until the frame changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(ios): share the layout manager config guard Both text views set the config only when it is new, so a streamed update doesn't redraw the whole text; one helper keeps the two from drifting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ios): say once in debug builds when UIKit has no text canvas The tiles find UIKit's text canvas by private class name; without it a long text quietly draws its whole frame again. A debug log makes that visible when an iOS release renames the classes. Also fixes two comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(ios): let a document's one visible area drive its text segments Each text segment, nested quote text included, built a visible area of its own: on a long document hundreds of objects observing the same scroll views. The EnrichedMarkdown host's area now updates its segments' viewports, which read it in their own coordinates; a text with no document (EnrichedMarkdownText) still follows the scroll views itself. updateDrawnBlocks becomes updateBlockBitmaps, apart from updateDrawnSegments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ios): follow a scroll view that grows without scrolling The visible area observed only contentOffset, so a scroll view getting taller (a keyboard going away, a resized sheet) showed more of a text than it drew. It observes the scroll views' layer bounds instead, which a scroll moves too. The header now says the area holds the views above it until a read after it left the window, and that it doesn't notice a move under other scroll views in the same window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(ios): mark the block views whose bitmaps can be dropped Which views of a block to drop off screen was guessed from a drawRect: override outside UIKit's bundle, which would also take a view of any other framework. The library's five self-drawing block views now adopt ENRMDroppableContent instead, and the run loop order that puts the drop after Core Animation's commit gets a name and a reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ios): cover dropping the bitmaps of blocks off screen A code block or table scrolled past the margin loses its bitmap and draws again when it comes near, one within the margin keeps it, and one made off screen stays empty after the run loop turn that would draw it. The tests drive a real EnrichedMarkdown, laid out through its segment layout as layoutSubviews does once Fabric set its frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ios): check that a document's text follows the document's area A text segment of EnrichedMarkdown has the document's visible area and draws the part a scroll shows, with no area of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: add the streaming prop and streamingConfig.animation `streamingAnimation` turned on everything streaming does, not only the fade: the streaming session (held-back tables, code blocks and media, repaired inline syntax), the pending code block header and every arrival animation. It is now `streaming`, with `streamingAnimation` kept as a deprecated alias (`streaming` wins when both are set). `streamingConfig.animation` ('fade' by default, or 'none') turns the arrival animations off without turning streaming off: the text tail fade, block and table row fades, and the grow-in of blocks drawn by renderers. Switching it to 'none' (or turning streaming off) shows what is still fading at once, on both platforms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: document the streaming prop and streamingConfig.animation `streamingAnimation` is documented as `streaming`, with the deprecated alias noted, and `streamingConfig` gains `animation`. Its example is renamed with the prop and now stops streaming once the text is complete. Also corrects the reference: `streamingConfig` works in both flavors, not only `github`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: add onStreamingEnd Called when the view stops streaming, once `streaming` turns false. It fires once per stream, from where each host ends streaming, and not when the view unmounts mid-stream. iOS and Android only, like `streaming`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: document onStreamingEnd Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: bring docs-md streaming up to the streaming prop and animation MARKDOWN_STREAMING.md still said "Both modes" and showed an always-on streaming prop. It now mirrors the guide: streaming set while text arrives and turned off at the end, onStreamingEnd, the three block modes with mediaMode, and streamingConfig.animation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): hash only the streaming modes in the stream-update key Dropping `animation` from a copied map allocated two maps per measure and would hash any key added to streamingConfig later. Hashing the three modes, as iOS ENRMStreamingRenderEqual compares them, keeps the key to what changes layout. Tests on both platforms pin that flipping the animation keeps a stream's update on the fast path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ios): stop a block's fade without relying on UIKit's animation key UIView names its alpha animation after the key path, which is not documented; removing all of the segment's animations and setting its alpha does the same without that. Ending a stream and turning the animation off in one update now finishes the animations once. The arrival helper's comment also names the slot grow-in it gates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: complete the streaming JSDoc, web tables and examples The animation JSDoc gains the renderer grow-in and Reduce Motion, and onStreamingEnd its once-per-stream contract, as in the API reference. The web stripped-props tables list onStreamingEnd, and the streamingConfig examples end streaming once the document has arrived. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(example): use streaming instead of the deprecated streamingAnimation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: warn in development that streamingAnimation is deprecated react-native-streamdown is deprecated in favor of this package's own streaming, which holds back incomplete blocks and repairs half-written syntax natively. streamingAnimation now does that too while it is on, so a view that keeps it on renders a finished message the same way. A one-time development warning points to streaming, and both streaming guides and the README now explain the migration instead of recommending react-native-streamdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: stream markdown into a view without re-rendering it A growing `markdown` prop re-renders the component on every chunk and hands the whole text to native code each time. createMarkdownStream() returns a stream to pass as `stream` instead: append() copies only the chunk into a C++ buffer through the parser module, and the views showing the stream update once per frame with a few bytes of props (`streamId`, `streamLength`). end() stops streaming for the final render, reset() starts a new buffer. A stream only grows, so (id, length) names one text. The component descriptors fill `markdown` from it in cloneProps, so measurement and rendering on both platforms read a plain `markdown` prop, the same text. Android mounts views from the raw props, which get it too. The registry is defined in a .cpp: on Android autolinking compiles the descriptors into the app's library as well. dispose() frees the text once no view shows it, and a stream JS drops is freed through FinalizationRegistry. A chunk ending halfway through a surrogate pair holds that half back until the next one. `renderers`, `resolveImageSource` and `onLinksChange` collect from the buffer by id. Without the native module (web, Jest) the stream keeps its text in JS and passes it as `markdown`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: document createMarkdownStream and the stream prop The `stream` prop gets its reference section with a live example (the web build supports streams, so createMarkdownStream joins the live editor's scope), the streaming guide a section on streaming without re-rendering, and the web notes say a stream still renders there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: add MarkdownStream.getText() and ignore append() after end() `getText()` returns the text appended so far, for saving or copying a message; it reads the native stream (readStream), so JS keeps no copy. `append()` after `end()` or `dispose()` no longer throws: a late chunk from a network callback is ignored, with a warning in development. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: note that onStreamingEnd fires when the stream ends Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: end a stream when it is disposed dispose() without end() left a view still showing the stream streaming for good: held-back blocks never appeared, onStreamingEnd never fired, and appends were ignored. Disposing now ends the stream first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: hold back half a surrogate pair in a stream's initial and reset text createMarkdownStream(text) and reset(text) sent text ending in a high surrogate straight to native, where UTF-8 has no half characters. The text now goes through the same hold-back as append(), and appending it to an empty stream gives the byte length without an extra call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: keep the parser module on each markdown stream Reads, appends and disposes assumed the global module was still set whenever a stream had a native id; each stream now uses the module that created it, as does the finalizer. release() also zeroes the length with the id and text. Adds a test for the FinalizationRegistry path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: note getText() is empty after dispose() while a view shows the stream A view keeps showing a disposed stream until it unmounts, which the getText() docs read as contradicting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: pass the stream id and length to useCollectedMarkdown The memo depended on the snapshot object, so it parsed the stream again when only `ended` changed. Also moves setNativeMarkdownStreams() out from between the default labels' comment and the labels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: assign a streamed view's markdown once ENRMResolveStreamedMarkdown set markdown and the raw props in two branches; it now picks the text, then assigns it when it differs. The comment on the const cast says why the props aren't shared yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: list stream on web and in the Jest mock Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: add a gradient streaming animation and animation options `streamingConfig.animation` takes 'fade', 'gradient', 'none', or an object with options: { type: 'fade', duration } and { type: 'gradient', length, startColor, endColor } (#904). A type this version does not know shows new content at once, with a warning in development. How each new character looks is worked out in the shared core (StreamingEffects): a fade from each chunk's own arrival time, so chunks arriving every frame fade in fully instead of snapping, and a gradient from each character's distance from the end of the text. The newest character takes `endColor`, and the gradient settles to the text's own colors over 200 ms when the stream ends. The last chunk, arriving with the end of the stream, still animates before settling. The hosts only draw: iOS draws the animated glyphs in the effect's colors from the text tiles, with a display link only while the looks change over time; Android applies one span per run of equal looks, read in one JNI call per frame. A character's own alpha is kept, so hidden spoiler text stays hidden, and the text itself never changes, so selection, copy and accessibility are unaffected. This replaces ENRMTailFadeInAnimator, TailFadeInAnimator and FadeInSpan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: document the gradient streaming animation and its options streamingConfig.animation documents 'gradient' and the object forms with their options, and the streaming guide gains an Animations section on how fade and gradient behave and how to match a brand's colors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(core): treat a fade over no time or a gradient over no characters as no effect lookAt divided by the duration unchecked; configure now turns such a config into None, the one place the effects' options are checked. Adds tests for configure starting over, a gradient between two opaque colors and a tinted gradient settling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(android): split streaming effect runs out of the animator and test them The run computation (grapheme boundaries, runs of equal look) becomes StreamingEffectRuns, which keeps one BreakIterator instead of making one per frame. It uses android.icu's, which java.text's wraps on Android, so the JVM tests see the same grapheme rules: a surrogate pair and a ZWJ sequence the range starts inside, and plain runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): write streaming looks into the Java arrays in place nativeLooks filled three std::vectors each frame and copied them over; lookAt makes no JNI calls, so it now writes through critical array pointers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: apply Reduce Motion to streamed text from the next arrival The text effects read Reduce Motion once, when configured, so toggling it while a view was mounted changed the block fades but not the text. They now check it on each arrival, as the tail fade did, and start over when it changed. Android's StreamingEffects.configure takes the Config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: settle only gradients and skip text effects for 'none' Finishing a fade does nothing, so the hosts settle only gradients. With 'none' or Reduce Motion, Android no longer makes an animator and a core object for each streamed text segment. The block fade follows the parsed animation type on both platforms instead of a flag or the raw string, Android's config defaults live in one place, and a comment repeated in four files stays in one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): free a dropped text segment's streaming effects Segment views the reconciler removed kept their core object until the deprecated finalize ran, as textEffects holds them weakly. onViewRemoved now releases them, so finalize goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep the normalized streaming animation while its options are the same processColor makes a new object for a PlatformColor each render, so the memoised streamingConfig was rebuilt every time. useStreamingAnimation memoises on the raw type, duration, length and colors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: say the fade duration applies to text only Blocks and table rows keep a fixed 200 ms fade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: describe the gradient animation everywhere and fix comments the effects left stale docs-md/MARKDOWN_STREAMING.md listed only 'fade' and 'none'; it now has 'gradient' and the preset options, as the guide and API reference do. The slot reveal's ease was still called the tail fade's, which this PR removed, and the web guide called streamingConfig block handling only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: reveal streamed text word by word with streamingConfig.smooth Models and networks deliver text in bursts. streamingConfig.smooth reveals it word by word at a steady pace instead, the way chat apps do. Off by default. A pacer in the core (StreamingPacer) decides how much of the markdown a view shows at each moment: each chunk spreads over the time until the next one (a running average of the gaps, at most a second behind), and what is left shows within 200 ms when the stream ends. It reveals on word boundaries: a word a chunk ends inside waits for the rest of it, and markdown that only opens a line (a list marker, a heading's ##, a quote's >) waits for the word after it. The views render only the revealed markdown and get more about 30 times a second while words are waiting (a display link on iOS, a Choreographer callback on Android), so lines, list items and blocks grow with the words and a scrolled view follows them line by line. The shadow node already takes the view's laid-out size for markdown that extends what the view rendered; Android's measurement now also takes it when the view laid out a size other than its last answer, which a height request with unchanged markdown used to get back (a new line waited for the next chunk). When streaming ends with words still waiting, the view keeps streaming until they have appeared, then renders in full; a stream starting again in that window cancels the end. On Android a new line can be laid out before Yoga's commit gives the view its height, so the host clips to its bounds while pacing. The iOS host read UITextView.attributedText on every update, which copies the whole text; it reads the text storage instead. The fade runs per word too: a word split across two chunks fades in as one. CJK characters and attachments count as words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: document smooth pacing and the per-word fade streamingConfig.smooth gets its reference entry and a Smooth pacing section in the streaming guide: how the text, layout and blocks follow the words, how chunks are spread, and what waits for the next word. The fade is described per word. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: stop streaming when smooth pacing resets during the final reveal When a stream ended with words still waiting, the view kept streaming until the pacer's done callback. Turning smooth off or replacing the text in those 200 ms reset the pacer, so done never ran and the view stayed in streaming mode. The pacer's waiting now also covers a done still to run, and each host stops streaming once the stream has ended and nothing waits. Android paced the first text a view got, since every string starts with an empty one; it now shows it at once, as iOS does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: note that Reduce Motion keeps smooth pacing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: note that onStreamingEnd waits for smooth pacing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: size views with renderers to the text smooth pacing has revealed With custom `renderers`, the shadow node measured the whole `markdown` prop, while smooth pacing shows only the words revealed so far: blank space opened below them, and slots for blocks not reached yet were laid out ahead of the words. The whole document is still measured, so every slot keeps its placement and a block's space is reserved as soon as it is revealed. While the view shows only a start of the markdown, the shadow node takes the height it laid that start out at (iOS ENRMLaidOutSize, Android MeasurementStore), and slots that start below it stay hidden until their words arrive. A slot that has started shows while it grows, as text does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(core): reveal a chunk's last CJK character without waiting The pacer held a chunk's last word until a space or the next chunk arrived, so text written without spaces kept its last character back for up to half a second on every chunk. A character that is a word of its own is complete as it arrives, unless the chunk ends halfway through its surrogate pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(macos): pace smooth reveals with a timer ENRMStreamingPacer used CADisplayLink, which macOS does not have, with no TARGET_OS_OSX guard, though the podspec builds for macOS. On macOS it now ticks from a timer at the same 30 a second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(core): end smooth streams in StreamingPacer The drain after the streaming prop turns off (finish, resume, ending once, ending at once when the drain is cut short) lived in four host copies on top of two wrapper twins, and drifted between them. The core pacer now takes the text, the prop and smooth in one update that says whether the stream ends now, and drained() says when the drain finished, once. The cases the hosts handled are tested here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: let the core pacer end smooth streams on every host Each host now hands the pacer its markdown, streaming prop and smooth in one update and stops streaming when it says so; the wrappers are a frame source and a substring. The Android text view paced the text as props were set, so a prop turning on in the same update as text could be seen late; it now updates once every prop is set, in commitProps, like the container. The prop turning off no longer re-renders the unchanged prefix while the last words drain, and a pacer callback that outlives its iOS view does nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): take a stale laid-out size only with smooth pacing A view whose size differs from the last answer stands in for one asking again only while smooth pacing renders part of the document. Without it, that size is a render still in flight, and a repeat measurement of the same markdown took it over the full answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: tidy smooth pacing's size check and prop reads The partial laid-out size now takes one copy under the lock for both checks, smooth is read without copying streamingConfig into a map, and the draw clip says why it leaves the sides open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: document smooth in docs-md, its default and macOS docs-md/MARKDOWN_STREAMING.md had no smooth section, the API reference's streamingConfig default and the guide's reference left smooth out, and the guide said marker-only lines wait for the next word without saying they show after half a second when the stream stalls. The macOS pages still spoke of the tail fade, which 'fade' and 'gradient' replaced; smooth paces on macOS too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(core): parse only what follows a stream's finished blocks Every update of a streamed document parsed its whole text again, and collected its slots, images and links again. The store now parses a streaming snapshot in two parts: the blocks before its finishedBytes once per stream (FinishedBlocks), and what follows them on every update. The result is the tree a whole parse gives, and the finished blocks keep the same nodes from one update to the next, which lets the hosts convert and render only what is new. Parsing in parts falls back to parsing the whole text whenever the two could differ: - A link reference definition changes links anywhere in the document, so a text with a line that could start one is parsed whole (mayDefineLinkReference errs on the side of true). - The finished blocks are parsed with a probe paragraph after them. It comes back as the last node only when the parser has closed every block before it; inside a fence or an HTML block the filter did not see, it is swallowed, and the stream is parsed whole from then on. - The rest must begin with a line that starts a block of its own. BlockCollector collects in parts with the ids a whole collect gives. incremental_parse_test streams the fixtures and 400 generated documents in several chunkings, flag sets and interleavings, and compares every state with parsing its text whole: tree, slots, images and links. On a Mac, parsing each update of a 66 KB answer streamed in 60-byte steps goes from 617 to 26 us (321 to 13 ms for the whole stream). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * perf(ios): convert and hash only a stream's new blocks A stream's finished blocks keep their nodes from one update to the next (DocumentStore), but every update still copied the whole tree into Objective-C nodes and hashed every node for the reconciler and the text render cache. The parser now takes the converted nodes of the blocks a recent conversion with the same options already holds, and converts only the rest; link recognition runs over the new blocks only. A node keeps its signature once computed, and a conversion stays in front of the recent ones while it is in use. On an iPhone 15 Pro, over 14 s of a 66 KB answer streaming in, the render queue's work goes from 1,285 to 399 ms: parsing and converting from 627 to 77 ms, hashing from 276 ms to none. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * perf(android): convert and hash only a stream's new blocks As on iOS: the JNI conversion takes the Kotlin nodes of the blocks a recent conversion with the same slot ids already holds and creates only the rest, and a node keeps its signature once computed. Conversions with link recognition are converted whole, as before. On a Galaxy A16, a 66 KB answer streaming in takes 66.5 s of process CPU instead of 71.2 s, and the 80 KB document 65.7 s instead of 73.6 s. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix: reuse the longest finished start and the same document's conversion DocumentStore took the first entry whose finished blocks the text starts with, not the longest, so a stream could parse again, as new nodes, blocks another entry held (smooth pacing keeps a shorter state in front). Android converted the same document again and stored a duplicate that could evict another stream's conversion; it now returns the stored one, as iOS does. It also counted a stored conversion's children with JNI calls under the cache lock; the count is now taken once, when the conversion is stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(core): keep the block visitor file-local BlockCollector hands its id counts to the visitor instead of making it a friend, so the visitor stays in the anonymous namespace as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(core): copy a stream's finished blocks only when they grow The copy ran before the probe's result was known, and a failed probe kept the copied collector though nothing reads it again. Copy on success only; a failure stores an empty FinishedBlocks that is no longer extendable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(core): check per stream that finished blocks keep their nodes Adds sharedLeadingBlocks(), the count both hosts use to take over an earlier conversion, so it is tested here: every state parsed in parts must share the previous state's finished blocks, not just some blocks across the run. Also covers another text with the same finished start whose next line continues the list above, which only the start check catches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: share the leading-block count and the JNI node tail Both hosts count the blocks a recent conversion shares with the core's sharedLeadingBlocks(). On Android createDocument converts the new blocks directly instead of through a temporary Document, and builds its node with the same helper as create. States the bound of the recent conversions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(ios): cache a node's signature in one atomic, 0 until computed Matches Kotlin's cachedSignature. The setters reset only the node's own signature, never its ancestors', and writes through the mutable collections skipped them anyway; nothing changes a node after the parse, so the invalidation goes. A real hash of 0 is just computed again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ios): convert a stream with link recognition on Links are recognized only in the blocks converted anew; each state must still match a fresh conversion with the same regexes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(core): keep parsing a stream in parts past code that reads like a reference definition A line such as `[key: string]: number;` inside a fenced code block counted as a possible link reference definition, so every later update of the stream was parsed whole: a coding answer lost incremental parsing for good. The check now skips the lines of a fence that opens at the start of a line. After raw HTML, display math or a table row it checks every line, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf: keep a stream's converted blocks when a new block slot becomes active The iOS and Android conversions of a streamed document were reused only under the same active slot ids. Each code block that arrived with a renderer added an id, so the whole document was converted again. They now keep the finished blocks before the first one whose slot changed, which a new block never is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ios): reflow the text by its font in the late image layout test The test resized the text container to make the text reflow. A document's viewport holds the container's size (#1149), so the resize did nothing and the elements' frames never changed. Growing the font reflows the text with either container. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ios): redraw the tiles when an image asks for its characters TextKit doesn't pass every invalidateDisplayForCharacterRange: on as a glyph range, so a tile drawn text view never heard of some of them: a block image that loaded off screen and was scrolled to in one jump kept the image scaled for its placeholder, stretched, or stayed blank once block images are scaled only when drawn. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * perf(ios): scale a block image once, at the width its line gives it A loaded block image was scaled for the placeholder's width first (a square of the image height) and again for its real width once drawn. The two sets together overflowed the 30 MB cache of scaled images, so later occurrences of the same image were scaled again as well. A block image now waits for the draw that tells its width. On an iPhone 15 Pro, a 66 KB answer with 35 images (7 distinct) streaming in scales 7 images instead of 74, and the work off the main and JS threads goes from about 2.0 to 0.85 s. A fixed-height box only draws again when its image loads; a maxHeight or aspectRatio box lays out again too. An image found in the cache during a draw is returned by that draw, without a second one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * perf(ios): draw a thematic break's image once The attachment rendered a new image on every draw, and a streaming animation draws the tiles of the text 60 times a second: 276 ms of the main thread over 14 s of a stream on an iPhone 15 Pro. The images are now kept in one small cache keyed on size, line, margin and resolved color: the rules of a document share one, and a dynamic color draws again when the appearance changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * perf(ios): walk only the drawn text for code backgrounds CodeBlockBackground and CodeBackground enumerated their attribute over the whole text on every draw. A tile draws 512 pt of a long document, up to 60 times a second while text fades in, so the walk cost more than the drawing. They now walk the drawn range and extend only the runs at its edges, so a box crossing a tile edge is still drawn whole. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(ios): draw text in 256 pt tiles A fading line redraws its tile and every tile below it on each frame, images included. At a model's pace (150 characters a second) 256 pt tiles take 12% less main thread than 512 pt ones, and 2% less at the bench's fast rate; scrolling a long document costs the same. 128 pt tiles were 20% cheaper at a model's pace but 28% dearer at the fast rate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(ios): find a fade's colors once per word The tiles drew a fade by computing a color, a character cluster and an own color for every animated character, though a chunk's words share one look. The core's StreamingEffects::lookEnd now says where a look ends, so the tiles compute one color for each stretch of one look and one own color. Character sequences stay whole. Simulator, 66 KB chat stream: the animated glyph drawing goes from 723 to 486 ms per 14 s, the main thread 3-5% down over the stream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(core): size the UTF-8 and UTF-16 conversions before writing them toUtf8 and toUtf16 grew their strings one push_back at a time. On Android, libc++ keeps std::string's push_back out of line in its shared library, so each byte was a call; Android's render thread converts a stream's whole text on every update, for the streaming filter and again for the parser. They now count the output, size the string once and write through a pointer. 66 KB, on a Mac: toUtf8 166 to 40 us, toUtf16 115 to 20 us. Galaxy A16, 66 KB chat stream: the render pool thread 6.7 to 5.3 s CPU. The test checks both against the previous code on 20,000 random strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: call onStreamingEnd once the last words are on screen Every host called onStreamingEnd as streaming stopped, then rendered the whole text: a handler that scrolled to the end or measured saw the height before the final render. The event now waits for the first render scheduled after the stream ended, unless that render asks for another in full (a view that missed a patch), and fires at once when there is nothing to render or a new stream starts first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(ios): cap the streaming effects display link at 60 Hz and stop it off a window The display link that redraws fading text had no frame rate range, so it ran at 120 Hz on ProMotion screens while the core's pacer runs at 30, and it kept ticking for a text view that left its window while text arrived. It now asks for 30 to 60 Hz, stops off a window, and starts again when the text view is back on one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): compare the whole stream-update key, with density and direction A stream update took the view's laid-out size when a 32-bit hash of the layout props matched the last measurement's, and the hash left out the screen density and the layout direction. A collision or a density or direction change could hand back a size laid out for other props. The key is now a data class compared whole, as iOS compares its key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): resume a streamed text only after a newline Resuming a text segment at a top-level node trusted that the node before it ends in "\n"; a node kind that didn't would join the next one's first line. The cache now records where the text before each node ends in a newline and renders in full elsewhere. iOS guards its resume too, by comparing the text before it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(ios): take the view's height for a streamed document with block slots With block renderers every update of a stream rendered and laid the whole document out again on the JS thread to place the slot children: 96% of that thread on the iPhone 15 Pro for an 80 KB stream with code blocks. The view now publishes, with the size it laid out, the slot placeholders at the root of its stack (where each starts and the height it reserved), and counts a slot growing in at its reserved height. A stream's update takes that height and keeps the last full measurement's slot frames when the view shows every slot where the measurement placed it, at the height its child still has (ENRMCanTakeLaidOutSlotLayout). Anything that moved a slot (an image above it that loaded), a placement the view hasn't applied yet, a slot in a quote or a new slot block measures in full, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(ios): grow a streamed document by the code block streaming into its last slot While a code block streams into its renderer at the end of the document, its child grows on every update, so the slot check failed and every update inside the fence measured the whole document again. When the snapshot ends inside that open fence and the view shows every slot as measured, the document's height is where the last slot starts, plus its child's new height, plus what followed it at the last full measurement (ENRMGrowingTailSlotHeight). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): take the view's height for a streamed document with block slots With block renderers every update of a stream rendered and laid the whole document out again to place the slot children: 80% of the JS thread on an emulator for an 80 KB stream with code blocks, as on iOS. The view now publishes, with its laid-out size, the slot placeholders at the root of its stack, and counts a slot growing in at its reserved height. A stream's update takes that height when the view shows every slot the last full measurement placed, at the height its child still has, or grows the document by the code block streaming into its last slot (SlotLayoutReuse, the rules iOS uses). The walk adds up fractional px and the view whole ones, so their positions drift apart down a long document: a shown slot takes the view's position rather than being compared with the walk's. Measuring the slots' children again records their frames there for the shadow node. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): draw inline code and highlight backgrounds from the text's layout Inline code and highlight backgrounds were LineBackgroundSpans that found where their span starts and ends on a line by laying the whole line out again, twice per span per line on every draw: 28% of the main thread on an emulator for a 66 KB streamed answer (35% on a Galaxy A16), and paid by static text on every frame too. The private layout was also 10000 px wide and left to right, so centered, right-to-left and justified lines drew the background away from the glyphs. The text views now run their own background pass under the text (TextBackgroundDrawer), as iOS draws it in its layout manager: blockquote fills first, then highlight and inline code backgrounds on top of them. The edges are the layout's getPrimaryHorizontal, so leading margins, alignment and direction place them under the glyphs; a wrapped span runs to its line's edges in the paragraph's direction, with its rounded ends mirrored on right-to-left lines. Positions are kept per line until the text, the layout or an inline element's width changes. The pass clips to the box TextView clips its text to, and finds a line's end from its extent rather than getLineLeft/getLineRight, which count a leading margin twice before Android 10. The spans stay as markers for copy and export. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): measure with keys instead of serialized props Every Yoga measure serialized the layout props, the whole markdown with them, into a new ReadableNativeMap, and Kotlin deep-copied the style and md4c flags into HashMaps to hash and compare them. While a 66 KB answer streams, Yoga measures twice per update and the measure step took 29% of the JS thread on a moto g57 power, though stream updates reuse the size the view laid out and measure almost nothing. Each shadow node now keeps two keys for its props: one per distinct layout config, interned by value so views with the same style share it, and one per distinct markdown. Measurement sends only the keys; Kotlin keeps a MeasureConfig parsed once per config key and the markdown per view, and pulls either from the session installed around the call only when it doesn't have it. The measure step drops to 12% of the JS thread (the commit from 47% to 34%); heights are unchanged. The layout config leaves out the streaming animation, so changing it measures nothing again. textBreakStrategy now travels in the config: the first measurement used the default until the view existed. The view and measurement parse md4c flags with one function. A Jest test takes the native props from the codegen parser and classifies each, with the streaming config and md4c flag fields, as sent to Android measurement and read by Kotlin or as not laying the document out, so a missing layout prop fails CI instead of clipping text. The full measurement's cache key now covers the streaming flags, so the end of a stream or a smooth-pacing toggle measures in full once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style(core): split the streaming accessors as clang-format asks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: address the merge review of the streaming work Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): tell TextView's Editor of a streamed tail patch A tail patch told only DynamicLayout of the change, so TextView's Editor kept a word iterator over the text it last heard of. A double tap or drag that selects words on a text still streaming then asked for an offset past that text and threw IllegalArgumentException from WordIterator: the app crashed (Galaxy A16, three double taps on a streaming answer). The patch now also reaches TextView's own watcher (onTextChanged only: afterTextChanged would copy the text for autofill and content capture), which resets the Editor's word iterator and touch offsets. TextView scrolls to the selection on an edit, at once and before the next draw, so the view refuses bringPointIntoView from a patch until it draws: a patch still keeps the scroll position and the selection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: address the review of the streaming PR (#1185) * fix: address the review of the streaming PR - Android: a smooth reveal patches the text's tail instead of rendering it all again (keeps the render cache and the selection). - Android: gradient colors given as PlatformColor no longer throw. - A new stream that starts while the last one's words still drain ends the last one, on both platforms and both components. - The library reads `__DEV__` only through `isDev`, enforced by lint, so web bundlers without the global don't throw on mount. - streamingConfig.animation length is rounded, and a non-finite or sub-character one means none. - Docs: `markdown` is optional in the props (breaking changes), and how iOS text tiles affect snapshots and how to capture a long text whole. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ios): capture long text and blocks drawn only near the screen Text, code blocks, tables, quotes and math draw only near the visible area, so a capture of a long message came out blank further away (review of #1140). - renderInContext: the text tiles host layer draws the text straight into the capture, in the view's appearance; the document layer draws its dropped block bitmaps for it and drops them again. - drawViewHierarchyInRect: and snapshot views render through the render server and ask the views nothing, so they are hooked once (ENRMCapture): the text views and documents in the captured view draw the part it shows for the capture. Skipped for views over 8,192 px, which UIKit doesn't render, and off the main thread. A capture of the screen draws nothing new. - Docs: the known limitation now covers only views too tall for drawViewHierarchyInRect:, captures off the main thread, and previews that mirror the live view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): pace streaming renders to display frames and stop block scrollbar redraws (#1187) * fix(android): enable block scrollbars only once their content overflows A horizontal scrollbar enabled when a code, math or table block attaches fades out 1.2 s later and redraws every frame for 250 ms, even when the block doesn't scroll, so each block a stream appended kept the window drawing after the text had settled. The bar now turns on once the block is laid out wider than itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): start streaming renders on display frames, one at a time While streaming, each publish scheduled a render at once, so the window drew far more often than the text changed. Renders now start on a Choreographer frame, the next one waits until the last has applied, and while applying overruns 70% of a frame they space out up to 4 frames. Smooth pacing and arrival fades keep their own timing, and a render outside the pacing drops a paced one still waiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): render a growing list from its first changed item (#1188) A streamed update re-rendered the text from the last top-level node on, so a long list, often a segment's only node, was rendered, spanned and laid out again whole on every chunk. When both renders end in the same list after the same nodes, rendering now resumes at the list's first changed item, the rest of the list rendering as a continuation of it. A top-level list now takes one line-height span per item instead of one for the whole list, so a full render and a continuation produce the same spans. Ordered lists reaching 100 still render whole, since wider numbers widen every item's marker. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * perf(ios): start streaming renders on display frames, one at a time (#1189) Each streamed update rendered and applied at once, so several applies could land in one frame, each laying text out for a frame that showed only the last. Renders now start on a display link tick, the next waits until the last has applied, and while applying overruns 70% of a frame they space out to every 2nd-4th frame, as on Android. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * perf: re-render only the native view on a stream's frames (#1192) Each frame a stream published re-rendered the whole EnrichedMarkdownText: every hook, the props object and React's diff of it, for a frame that only changes streamLength. The view now follows the stream in a small leaf that takes the rest of its props from the component, which re-renders only when the stream ends. Collecting slots, images or links still reads the stream in the component. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): start paced streaming renders at most every 30 ms (#1193) Each render is a layout pass and a frame: a stream rendered on every display frame that had new text, drawing about 1.5 times the frames of a renderer that publishes once its work is ready. Paced renders now start at least 30 ms apart, every other frame at 60 Hz and every fourth at 120 Hz. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * perf: publish a stream about every other frame (#1194) A stream published on every frame with new text, so each frame was a React render and a Fabric commit. It now publishes at most every 25 ms, about every other 60 Hz frame, with a margin for a late frame callback; the end and a reset still publish at once. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * perf: publish a long stream less often A long text's updates add up to most of a stream's cost, while each one costs about as much as a short text's. Past 4 KiB the publish interval grows from 25 ms to 60 ms at 16 KiB, about 16 updates a second. Short texts are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: tidy the streaming work after review - Trim comments to what the code can't say; drop history narration. - Rename the JS module that normalizes streamingConfig.animation to streamingEffects, after the native StreamingEffects it feeds. - Remove unused Android StreamingEffects.reset() with its JNI function, and StreamingPacer::length(). - Say a stream publishes about every other frame, not once per frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: cover onStreamingEnd in the native views Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): keep rendering after a render throws an Error Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): render line-limited text without the tail cache Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): resume only the text segment the stream grew Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): reuse the laid-out size of a view hugging its content A view measured with an upper limit lays out at its widest line. Its size now counts for any wider width when no line wraps and nothing is sized to the width, so stream updates take the shortcut instead of measuring in full. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(android): keep the stream measurement inputs of two widths Yoga measures a shrinking node at its flex basis, then at the width it lays out at; with one width kept, the second measurement never took the shortcut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): flash the scrollbar of overflowing blocks when not streaming Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep a disposed stream's text for a view taking over in the same commit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: warn of an invalid stream on web and in the Jest mock again Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…he input (software-mansion#1166) * fix(input): keep the keyboard dismissed after a drag that starts on the input On iOS, an input inside a ScrollView with keyboardDismissMode="on-drag" focused itself again after a short drag that started on it. The drag dismissed the keyboard, but the input kept the JS responder. The release then counted as a press, and a press focuses the input. The input now tracks how far the touch moves from where it went down. After more than 10 points the press no longer focuses the input, also when the finger comes back to where it started. onPress still fires. A drag on an unfocused input no longer focuses it either. React Native's TextInput focuses itself in the same case, so this is a deliberate difference from it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * chore(example): add a regression story for the input re-focusing after a drag The story puts the enriched input and React Native's TextInput in a ScrollView with keyboardDismissMode="on-drag" and shows a focus and blur count for each. A short drag that starts on the enriched input must leave its focus count unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(input): leave focusing on iOS to the native text view The input no longer focuses itself from JS on iOS. The host view now sends touches on its padding and in the hitSlop area to the text view, so UIKit alone decides: a tap focuses the input and a drag does not. This replaces the 10 point drag check, which repeated UIKit's own tap-or-drag decision with a different threshold. A tap on the padding or in the hitSlop area now also moves the caret. Android and macOS keep the JS focus call. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…e a highlight (software-mansion#1108) * feat(ios): give links corners and a border, and keep their fill inside a highlight Link() and Link(matching:) take .cornerRadius(_:) and .border(_:width:). A rounded or bordered link is drawn by the decoration views at the height of its text, from line-fragment caret positions, with TextKit's segment enumeration as the fallback on mixed-direction lines. Inside a ==highlight== a link with a fill of its own keeps it whichever wraps the other; a link without one sits on the highlight. Copy as HTML carries the border and radius. The corner radius modifier moves into CornerRadiusThemeElement, shared by CodeBlock, BlockImage, Table and Link. Follows up jnowakow's review of software-mansion#1085. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(ios): give link borders room beside, above and below the text Follows up jnowakow's review of software-mansion#1108. A link's drawn box is now one box per link, so neighbouring links of one style stay apart, and it follows text raised by a line height. The border is stroked around the box, under the text; a paragraph whose line height leaves no room for it grows to fit and re-centres its text, the view adds the room TextKit 2 leaves out under the last line, and every line is inset by the widest border so a link at the margin keeps its outline. An inline image inside a bordered link reserves the border width around itself. A highlight that holds a bordered link is painted by the drawer beneath the border, and an inline code chip inside a drawn link stays above its fill. Table cells draw the same boxes through a TextKit 1 stack and take the link colour instead of the system blue that string drawing paints. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(ios): add a Links screen with mention style controls to the example app Style and tint pickers, border, radius and line height sliders and an underline toggle drive two Link(matching:) variants over mentions, avatars, highlights, inline code and a table, with an alert on link press. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * test(ios): keep the table link tests cheap for Xcode 26.3 to type-check CI builds the test bundle with Xcode 26.3, whose Swift compiler gave up on an expression in the two new table link tests ("unable to type-check this expression in reasonable time"), so no iOS unit test ran. Xcode 27.1 compiled the same code without complaint. The pixel reads now go through one shared helper, and the tests spell out their types instead of leaving closures over literals, subscripts and `??` for the solver to work out. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(ios): keep padded image placeholders safe when views render at once Each view renders on its own queue, so two views with bordered image links wrote the shared placeholder dictionary together and could crash. The placeholders now live in an NSCache, which is thread-safe and bounded. Also splits the line-height guard in InlineBackground into a named value so it reads more easily. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ios): raise inline images with the text when a link border grows the line Since software-mansion#1157 an inline image takes a fixed line's raise through its own offset, set once. When a bordered link grew its paragraph's lines, the text was centred again but the images kept the old offset and sat lower than the text. The fit now clears that offset first, and leaves images out when it works out the line a border needs, so a paragraph holding only linked images keeps its natural line. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ware-mansion#1199) Fabric places EnrichedMarkdownText only when it mounts and never runs the layout that setText() and other TextView setters request. While that layout is pending, TextView's onPreDraw hands the scroll that keeps the cursor in view to the next onLayout, which never comes. A view that received its text while still 0 px tall (StreamdownText mounts with empty markdown, then sets the text a tick later) took a scroll at that height and kept it once it grew, so its first line was cut off and the same space was left empty at the bottom (software-mansion#1196). Run the pending layout at the frame Yoga gave the view in onPreDraw, before TextView acts on it.
…oftware-mansion#1204) The gradient's end now glides toward the end of the text at a steady speed instead of jumping on every chunk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ftware-mansion#1205) Table headers show as soon as their line ends, smooth reveals a table row as one step, and finished text settles its gradient instead of waiting for the next block. The filter takes a tables option set from the flavor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xt (software-mansion#1206) Code boxes take the average visibility of their characters, and list markers that of their item's first character, so no empty box or lone bullet shows before its text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oftware-mansion#1207) A wider cell widens its column over 0.25 s, and new rows fade in where they are drawn. Includes Android fixes for table relayout, the row overlays' width, and fading by row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…are-mansion#1209) TextViewLayoutManager is set onto layout managers UIKit already made (object_setClass), so an ivar's storage lies past the instance. software-mansion#1206 added two properties for the effects a tile draws its backgrounds with, which synthesized ivars, wrote past the object and failed testTheLayoutManagerClassHasNoIvars on main. The effects and their time are now associated objects, set only while drawBackgroundForGlyphRange:atPoint:effects:time: draws, like the glyph color the class already keeps that way. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…acter (software-mansion#1143) Copying a selection like **What** from a list item gave **W****hat**: the extractor wrapped each attribute run separately, and runs also split on attributes with no inline meaning, such as the list-marker anchor on an item's first grapheme. Runs with the same inline delimiters as the segment that still ends the output now extend that span. Co-authored-by: Dan Sanduleac <dan@sanduleac.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…mansion#1169) * fix(ios): lay a failed image out again once the view draws A failure that arrived before the view had drawn found no text view to tell. The text stayed laid out with the square and the component kept the height it measured with it. The attachment now remembers the change, and when it first draws it lays its range out again and reports the new size. * fix(ios): report a failed image's new size when the view lays it out Report the change as soon as a view's layout reaches the attachment, so a view below the fold gets its height right before it scrolls into view. Only record a report when a size was already handed out, so an image that failed before any measurement does not lay itself out and re-measure again. The test now follows the app: measure without a view, fail, then lay the text out in a text view linked to its container.
…ing (software-mansion#1126) * fix(web): wrap long words in EnrichedMarkdownText instead of overflowing The web renderer set no `overflow-wrap`, so a word longer than the line - in practice usually a URL - ran past the container rather than wrapping the way it does on iOS and Android. The web input already breaks such words; the text component did not. Set `overflow-wrap: anywhere` on the root element, ahead of `containerStyle` so apps can still override it. `anywhere` is used rather than `break-word` because it also lowers the min-content width: with `break-word`, a content-sized bubble or a `flex: 1` item with the default `min-width: auto` still grows to the URL's width. Table wrappers reset it to `normal`. Inherited into the cells, `anywhere` would let the auto-sized columns shrink below their words, so a wide table would break every word instead of scrolling horizontally as it does today. Code blocks are unaffected because `<pre>` does not wrap. Fixes software-mansion#1118 * fix(web): wrap long words with break-word instead of anywhere `anywhere` also lowers the min-content width, so short words break mid-word when a layout sizes to content, such as a label beside a long paragraph in a flex row. `break-word` keeps them whole. A flex item with the default `min-width: auto` still needs `min-width: 0`, which the web guide now covers. The test no longer polls for the parser, which loads before the tests run. --------- Co-authored-by: Jan Nowakowski <janeknowakowski9@gmail.com>
ubuntu-latest is now ubuntu-26.04, which no longer ships libxml2.so.2, so the prebuilt SwiftLint Linux binary fails to load (exit 127). It only showed on a turbo cache miss, so the job looked green on main while it could not run. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…hem and honor reduced motion (software-mansion#1079) * fix(android): conceal spoilers on any background, hide images and honor reduced motion Ports the spoiler implementation of packages/enriched-markdown-android (software-mansion#821, software-mansion#903, software-mansion#930): SpoilerSpan now conceals by drawing its text transparent (a fading textAlpha) instead of the overlay painting the nearest ancestor background over it, slices extend over block images, and reveals scale with the system animator duration scale (instant with animations off). The public CustomSpoilerOverlay API is left out; the spoilerOverlay prop maps to the built-in Particles/Solid overlays tuned by the spoiler style. Table cells get a spoiler drawer too, and the overlay prop now reaches existing drawers and nested blockquote text views. * fix(android): keep a spoiler reveal tap from reaching the parent Pressable A press on a concealed spoiler now counts as an active link touch, so the parent's intercept is blocked and the JS touch is cancelled. Before, a spoiler over a link or image lost that protection once the link was made inert.
…ftware-mansion#1198) * feat: rename or translate admonition titles with admonitionTitles * refactor: pass admonition titles outside markdownStyle * fix: use clip instead of hidden
…ckages (software-mansion#1200) * feat: rename or translate admonition titles in the iOS and Android packages * feat(android): set admonition titles for a subtree with LocalAdmonitionTitles
* fix: mirror right-to-left admonitions and quotes * docs: correct the RTL notes for quote bars and admonition titles * fix: give a nested quote the side of the quote around it * test(ios): pass the quote direction in the block slot stacking tests * test(ios): cover which side a quote's bar takes
…ion#1202) * feat(core): find the finished items of a streamed list finishedBlocksEnd() ends before a list, because an item line may belong to the list above, so a long list is prepared, parsed and rendered again on every update. finishedListItems() scans what follows the finished blocks for the last item of a top-level list that comes after other items of it. The text before that line holds whole blocks and the list's earlier items, which a host that keeps what it rendered can keep too. streamingListItems() gives the same for a snapshot, and only where the snapshot shows the items as the source wrote them. streamingSnapshot() and the hosts that use it are unchanged. Only the items' own text is finished: whether the list is tight or loose is still the whole list's. The parser also reads an item by the one before it, so a host parses the finished text with one more item after it and the rest from the last finished item on. The new test streams a list corpus and the fixtures a byte at a time and checks every split that way against md4c. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(core): count a tab as indentation when scanning code fences scanFences() measured a line's indent in spaces only, so a code line that starts with a tab looked unindented and ended a fence inside a list item early. The fence's closing line then seemed to open a new fence, which took the next item as code, and finishedListItems() reported the wrong last item. Indentation is now measured in columns, with a tab reaching the next multiple of four, and the indent of a continuation line is cut by columns too. Text without tabs is read as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…e-mansion#1064) * fix(android): copy code blocks inside list items as markdown ListItemRenderer splits an item's list spans around its code blocks, so the segments after a block don't draw the marker, and an item that opens with code gets its marker from a ListMarkerAnchorSpan instead of its own span. MarkdownExtractor ignored that: a block after the item's text lost its opening fence, the fence and code weren't indented so the list ended, an item opening with code lost its marker, and text after the code got its own "- ". A code block now records the innermost item holding it. The extractor indents the fences and code to that item's text column, puts the marker on the opening fence when the block opens the item, and continues the item (content indent instead of a marker) for segments that don't draw the marker. * fix(android): keep a second code block in a code-opened item inside that item * fix(android): keep one indent across a copied code block's highlighted segments * fix(android): point code blocks at a toggled task's new marker span * fix(android): fence a copied code block at its selected boundaries
Upstream merged Copy as Markdown (software-mansion#1143) identically to the fork's copy, so it merges away. selectionClipboard (software-mansion#962) now writes through upstream's selection copy paths (software-mansion#1125): copies report the canonical text the clipboard received through onSelectionCopy, and Android's writes go through writeClip. preserveWindowsPaths (software-mansion#1105) joins upstream's shared md4c flag tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream's streaming session check compares the snapshot with repairing every prefix whole. Repair, like its reference, reads `\(` as inline math up to the document's end, so after `C:\folder\(draft.` whole repair leaves a later paragraph's `*` unclosed while the snapshot, which is what renders, closes it. The fixture keeps the filter and growth checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The blockquote's context menu lifted the bare view, which has no background of its own, so its text was drawn straight over the dimmed thread. Give the highlight and dismiss previews the first opaque background behind the quote. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… again Upstream drops the bitmaps of ENRMDroppableContent views while their block is far off screen. Since #15 the code pane's content view draws nothing and a canvas child draws for it, so the dropped bitmap was an empty one. The untiled canvas now takes part instead; the tiled canvas keeps its own tiles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedToo many files! This PR contains 526 files, which is 226 over the limit of 300. To get a review, reduce the PR to 300 files or fewer by splitting it into smaller PRs or changing its base branch. Usage-priced reviews support at most 500 files.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncs
fork/t3-mobilewith upstreammainat 3a2c1ad (v1.2.0 plus 33 commits, including the rebuilt streaming API software-mansion#1140 andonSelectionCopysoftware-mansion#1125). The archive is1.2.0-t3.19, built from a01cbf4, the head of this branch.What changed
selectionClipboard(feat: copy links as Markdown in a copied selection's plain text software-mansion/enriched-markdown#962) now writes through upstream's copy paths. Copies report the canonical text the clipboard received throughonSelectionCopy, Copy as Markdown reports too, and Android writes go through upstream'swriteClip.preserveWindowsPaths(feat(core): opt-in preserveWindowsPaths md4c flag software-mansion/enriched-markdown#1105) joins upstream's shared md4c flag tables (JNIkFieldsandparseMd4cFlags). TheNativeMd4cFlags<bool,…>arity is 10, which matches the spec.MeasurementCache, a coalescingENRMAsyncRenderCoordinator, and a newENRMPreparedRenderStorecapped at 256.ENRMDroppableContentoff-screen bitmap dropping only dropped an empty bitmap. The untiled canvas now takes part, and the tiled one keeps its own tiles.t3/mobile-tarball) is now on this branch (upstream fix(ios): long-pressed blockquotes lift on an opaque preview software-mansion/enriched-markdown#1232).\(as inline math to the document's end, so the Windows path fixture (C:\folder\(draft.) runs only the tail-repair check. This reproduces on pure upstream with the fixture added. Upstream feat(core): opt-in preserveWindowsPaths md4c flag software-mansion/enriched-markdown#1105 will need the same change when it is rebased.pack-t3.mjs:upstreamCommitis now 3a2c1ad, and the archive addsPackage.swiftandspm-plugin.jsto match upstream's published files.Remaining deltas (all open upstream)
software-mansion#961 dev autolinks and hash routes (md4c#7), software-mansion#962 clipboard link metadata, software-mansion#1105
preserveWindowsPaths, md4c#6 strikethrough, software-mansion#1043 bracket LaTeX (md4c#4), software-mansion#1144 table-cell<br>, software-mansion#1145 Android span-order measuring, software-mansion#1231, software-mansion#1232.Not included
.yarnrc.yml, Podfile and Gradle changes, and conflicts inCMakeLists.txt.setBlockViews(both platforms), even with nohighlightsand no listener, an O(n) cost per streaming update. It's better landed together with #39836, after an early return when nothing listens.Verification
tsc, eslint and jest (1887 tests) pass. One new upstream guard neededselectionClipboardConfiglisted as not affecting layout.CC=clang CXX=clang++ scripts/test-core-parser.shpasses, and the goldens are unchanged. md4c and the WASM sources are unchanged, so no WASM rebuild.testDebugUnitTestandktlintCheckpass.🤖 Generated with Claude Code
Note
Sync fork/t3-mobile with upstream main (v1.2.0): streaming markdown, admonition titles, inline link backgrounds
createMarkdownStream,MarkdownStream,onStreamingEnd)admonitionTitlesprop,DEFAULT_ADMONITION_TITLES) across iOS, Android, web, and Compose, rendered with ellipsizedbdiheadersstreamingAnimationprop is replaced bystreaming/streamingConfig; on iOS the press focus handler no longer calls focus on iOS, and task-marker regex accepts quoted and ordered itemsMacroscope summarized a01cbf4.